﻿using Ec_System.Facade.Web;
using Ec_System.Models.Web;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Webdiyer.WebControls.Mvc;

namespace Ec_System.WebUI.Areas.Web.Controllers
{
    public class ShopController : Controller
    {
        VendorShopFacade vendorShopFacade = new VendorShopFacade();
        
        /// <summary>
        /// 店铺列表
        /// </summary>
        /// <param name="id">页面</param>
        /// <returns></returns>
        public ActionResult ShopList(int id = 1)
        {
            var result = vendorShopFacade.GetShopListWithPage(id, 9);
            var model = new PagedList<VendorShopData>(result.Result, id, 9, result.TotalCount);

            return View(model);
        }

        /// <summary>
        /// 店铺详情页
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult ShopDetail(int id)
        {
            var model = vendorShopFacade.GetShopDetailByID(id);
            ViewData["view"] = "shopDateil";

            return View("ShopList", model);
        }
    }
}